angular.module('mamApp').controller('chooseContractController', ['$scope', 'ContractManagementManager', '$state', '$uibModal','ImsDialog','$uibModalInstance','CommonManager',
    function ($scope, ContractManagementManager, $state, $uibModal,ImsDialog,$uibModalInstance,CommonManager) {
    $scope.total = 0;
    $scope.table = JSON.parse(localStorage.getItem("codeTable"));
    $scope.Ok = function () {
        $uibModalInstance.close($scope.data);
    };

    $scope.cancel = function () {
        $uibModalInstance.dismiss("cancel");
    };

        $scope.search = {};


        var getCpList = function (pageNo, pageSize,query) {
            CommonManager.contractList([pageNo, pageSize],query).then(function (result) {
                $scope.contractManagement = result.data.pageList;
                $scope.paginationConf.totalItems = result.data.total;
            })
        }

        $scope.paginationConf = {
            currentPage: 1,
            itemsPerPage: 5,
            pagesLength: 9,
            perPageOptions: [10, 20, 30, 40, 50],
            search: true,
            onChange: function () {
                getCpList(this.currentPage, this.itemsPerPage,$scope.search);
            }
        };
        $scope.contractExamineCheck= function (contract) {
            $scope.data=contract;
            $uibModalInstance.close($scope.data);

        }


}])

